<?php

namespace App\Remote\Tiger\Common;

use App\Exceptions\BaseException;
use App\Remote\Tiger\Remote;
use GuzzleHttp\Exception\GuzzleException;
use Symfony\Component\HttpFoundation\Request as RequestAlias;

class CommonRemote extends Remote
{

    /**
     * 生成短链
     *
     * @param string $url
     * @param string $code
     * @return mixed|void
     * @throws BaseException
     * @throws GuzzleException
     */
    public static function generateShortLinkUrl(string $url, string $code = "")
    {
        return self::customRequest(
            "internal/common/generateShortLinkUrl",
            RequestAlias::METHOD_POST,
            [
                "url"  => $url,
                "code" => $code
            ]
        );
    }

    /**
     * 获取配置详情
     *
     * @param string $module
     * @param string $name
     * @return mixed|void
     * @throws BaseException
     * @throws GuzzleException
     */
    public static function getConfigDetail(string $module, string $name)
    {
        return self::customRequest(
            "internal/common/getConfigDetail",
            RequestAlias::METHOD_GET,
            [
                "module" => $module,
                "name"   => $name
            ]
        );
    }

    public static function getWarZoneDistrictList()
    {
        return self::customCacheRequest(
            "internal/common/getWarZoneDistrictList",
            RequestAlias::METHOD_GET,null,null,8*3600
        );
    }

}
